<script>
$(function() {
	$( "#tabs" ).tabs({
	    select: function(event, ui) {
	        var url = $.data(ui.tab, 'load.tabs');
	        if( url ) {
	            location.href = url;
	            return false;
	        }
	        return true;
	    },
	selected: 1 
	});
});
</script>
<div id="tabs">
	<ul>
         <li><?php echo $this->Html->link(__('Chuyển sinh hoạt sinh viên', true), array('controller'=>'tgiachidoans','action' => 'chuyensinhhoat')); ?></li>
        <li><a href='#cd'>Danh sách chuyển sinh hoạt</a> </li>
</ul>
<div class="tgiachidoans index">
	<h2><?php __('Danh sách đoàn viên đã chuyển sinh hoạt');?></h2>
	<?php echo $form->create('Tgiachidoan');?>
    <table>
    <tr>
    <td><?php echo $form->input('khoahoc_id',array('id'=>'khoahoc','label'=>'Khóa học','type'=>'select','options'=>$khoahocs,'selected'=>$khoahoc));?></td>
    <td><div id='div_chidoan'><?php echo $form->input('chidoan_id',array('id'=>'chidoan_id','label'=>'Chi đoàn','options'=>$chidoans,'type'=>'select','selected'=>$chidoan,'empty'=>'--Chọn chi đoàn--'));?></div></td>
    <td><?php echo $form->input('namhoc',array('id'=>'namhoc','label'=>'Năm học','type'=>'select','options'=>$namhocs,'selected'=>$namhoc));?></td>
    <td><div id='div_hocky'><?php echo $form->input('hocky',array('id'=>'hocky','label'=>'Học kỳ','type'=>'select','options'=>$hockys,'selected'=>$hocky,'empty'=>'--Chọn học kỳ--'));?></div></td>
    </tr>
    </table>
    <?php echo  $js->submit('Thực hiện',array('url'=>array('controller'=>'tgiachidoans','action'=>'capnhatnoidung'),'update'=>'#div_noidung'))?>
    <div id='div_noidung'>
    <?php if(!empty($tgiachidoans)){?>
    <p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% mẫu tin', true)
	));
	?>	</p>
	<table cellpadding="0" cellspacing="0" id="tables">
	<tr>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Tên chi đoàn';?></th>
			<th><?php echo 'MSSV';?></th>
            <th><?php echo 'Họ tên';?></th>
			<th><?php echo $this->Paginator->sort('Ngày vào','Tgiachidoan.ngayvao');?></th>
			<th><?php echo $this->Paginator->sort('Ngày chuyển','Tgiachidoan.ngaychuyen');?></th>
			<th><?php echo 'Ghi nhận';?></th>
			<th><?php echo 'Nơi chuyển';?></th>
			<th class="actions"><?php __('Lựa chọn');?></th>
	</tr>
	<?php
	$i = 0; $stt=0;
	foreach ($tgiachidoans as $tgiachidoan):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $stt=$stt+1; ?>&nbsp;</td>
		<td>
			<?php echo $tgiachidoan['Chidoansv']['tenchidoan']; ?>
		</td>
		<td>
			<?php echo $tgiachidoan['Sinhvien']['mssv']; ?>
		</td>
        <td>
			<?php echo $tgiachidoan['Sinhvien']['hoten']; ?>
		</td>
		<td><?php echo $tgiachidoan['Tgiachidoan']['ngayvao']; ?>&nbsp;</td>
		<td><?php echo $tgiachidoan['Tgiachidoan']['ngaychuyen']; ?>&nbsp;</td>
		<td><?php echo $tgiachidoan['Tgiachidoan']['ghichu']; ?>&nbsp;</td>
		<td><?php echo $tgiachidoan['Tgiachidoan']['noichuyen']; ?>&nbsp;</td>
		<td class="actions">
			<?php //echo $this->Html->link(__('View', true), array('action' => 'view', $tgiachidoan['Tgiachidoan']['id'])); ?>
			<?php echo $this->Html->link(__('Cập nhật', true), array('action' => 'edit', $tgiachidoan['Tgiachidoan']['id'])); ?>
			<?php //echo $this->Html->link(__('Delete', true), array('action' => 'delete', $tgiachidoan['Tgiachidoan']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $tgiachidoan['Tgiachidoan']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% mẫu tin', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
	<?php }?>
</div>
</div>
</div>
<?php $this->Js->get('#khoahoc')->event('change',
							$this->Js->request(array('controller' => 'tgiachidoans', 'action' => 'updatechidoan'),
							array('update' => '#div_chidoan','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));?>
<?php $this->Js->get('#namhoc')->event('change',
							$this->Js->request(array('controller' => 'tgiachidoans', 'action' => 'capnhathocky'),
							array('update' => '#div_hocky','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));?>